package com.oracle.applicaiton.service.impl;

import com.oracle.applicaiton.feign.MemberFeign;
import com.oracle.applicaiton.service.LoginServiceApi;
import com.oracle.applicaiton.vo.MemberVo;
import com.oracle.application.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author bug制造者
 * @ClassName LoginServiceImpl.java
 * @createTime 2021年07月08日 14:48:00
 * @Description
 */
@Service
public class LoginServiceImpl implements LoginServiceApi {

    @Autowired
    private MemberFeign memberFeign;

    @Override
    public R<MemberVo> verifyLogin(String loginname, String pwd) {
        R<MemberVo> memberVoR = memberFeign.loginMember(loginname);
        MemberVo dbMember = memberVoR.getData();
        if (dbMember==null){
            return new R<>(201, "账号或密码不存在", null);
        }
        if (dbMember.getPwd().equals(pwd)){
            dbMember.setPwd(null);
            return new R<>(200, "ok", dbMember);
        }return new R<>(201, "未知错误！", null);
    }
}
